<%= form_tag(target, method: method, role: "form") do |f| %>
  <div class='row'>
    <div class="form-group col-md-4">
      <%= label_tag :addr, nil, class: 'control-label' %>
      <%= text_field_tag :addr, @server.addr, class: 'form-control' %>
    </div>
    <div class="form-group col-md-4">
      <%= label_tag :protocol, nil, class: 'control-label' %>
      <%= select_tag :protocol, options_for_select(Cluster::Protocol, @server.protocol), class: 'form-control' %>
    </div>
    <div class="form-group col-md-4">
      <%= label_tag :max_qps, nil, class: 'control-label' %>
      <%= number_field_tag :max_qps, @server.max_qps, class: 'form-control' %>
    </div>
  </div>
  <div class='hori-line'><span>HeathCheck</span></div>
  <div class='row'>
    <div class="form-group col-md-5">
      <%= label_tag :'heath_check[path]', :Path, class: 'control-label' %>
      <%= text_field_tag :'heath_check[path]', @server.heath_check.try(:path), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'heath_check[body]', :Body, class: 'control-label' %>
      <%= text_field_tag :'heath_check[body]', @server.heath_check.try(:body), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'heath_check[check_interval_in_second]', 'Check interval (s)', class: 'control-label' %>
      <%= number_field_tag :'heath_check[check_interval_in_second]', @server.heath_check.try(:check_interval_in_second), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'heath_check[timeout_in_second]', 'Timeout (s)', class: 'control-label' %>
      <%= number_field_tag :'heath_check[timeout_in_second]', @server.heath_check.try(:timeout_in_second), class: 'form-control' %>
    </div>
  </div>

  <div class='hori-line'><span>CircuitBreaker</span></div>

  <div class='row'>
    <div class="form-group col-md-5">
      <%= label_tag :'circuit_breaker[close_timeout_in_second]', 'Close timeout (s)', class: 'control-label' %>
      <%= number_field_tag :'circuit_breaker[close_timeout_in_second]', @server.circuit_breaker.try(:close_timeout_in_second), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'circuit_breaker[half_traffic_rate]', 'Half traffic rate', class: 'control-label' %>
      <%= number_field_tag :'circuit_breaker[half_traffic_rate]', @server.circuit_breaker.try(:half_traffic_rate), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'circuit_breaker[rate_check_period_in_second]', 'Rate check period (s)', class: 'control-label' %>
      <%= number_field_tag :'circuit_breaker[rate_check_period_in_second]', @server.circuit_breaker.try(:rate_check_period_in_second), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'circuit_breaker[failure_rate_to_close]', 'Failure rate to close', class: 'control-label' %>
      <%= number_field_tag :'circuit_breaker[failure_rate_to_close]', @server.circuit_breaker.try(:failure_rate_to_close), class: 'form-control' %>
    </div>
    <div class="form-group col-md-5">
      <%= label_tag :'circuit_breaker[succeed_rate_to_open]', 'Succeed rate to open', class: 'control-label' %>
      <%= number_field_tag :'circuit_breaker[succeed_rate_to_open]', @server.circuit_breaker.try(:succeed_rate_to_open), class: 'form-control' %>
    </div>
  </div>

  <div class='form-group col-md-11'>
    <%= submit_tag '提交', class: 'btn btn-default' %>
  </div>
<% end %>
